package com.itheima.reggie.common;

import lombok.Data;

import java.util.HashMap;
import java.util.Map;

@Data
public class R <T>{
    private Integer code;
    private T data;
    private String msg;
//    动态数据
    private Map map=new HashMap();
    public static <T> R <T> success(T object){
        R<T> r = new R<>();
        r.setCode(1);
        r.setData(object);
        return  r;
    }
    public static <T> R <T> error(String msg){
        R<T> r = new R<>();
        r.setCode(0);
        r.setMsg(msg);
        return r;
    }
}
